﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zocono.WCS.Domain.EntityInfo;
using Zocono.WCS.Domain.PlcConnectionDomain;
using Zocono.WCS.Infrastructure.ApllicationDto.WCSTaskDto;
using Zocono.WCS.Infrastructure.ApllicationDto;
using Zocono.WCS.Infrastructure.ApllicationDto.DtoWcsManage;

namespace Zocono.WCS.Application.AppConfigureManage
{
    public class PlcConnectionInfoApp
    {
        private readonly IPlcConnectionInfoService _PlcConnectionInfoService;
        public PlcConnectionInfoApp(IPlcConnectionInfoService plcConnectionInfoService)
        {
            _PlcConnectionInfoService = plcConnectionInfoService;
        }
        public async Task<PageDto<PlcConnectionInfo>> GetPagedPlcConnectionInfoAsync(QueryPlcConnectionInfoDto queryPlcConnectionInfo)
        {
            return await _PlcConnectionInfoService.GetPagedPlcConnectionInfoAsync(queryPlcConnectionInfo);
        }

        public async Task<List<PlcConnectionInfo>> GetPlcConnectionInfoAsync()
        {
            return await _PlcConnectionInfoService.GetPlcConnectionInfoAsync();
            
        }

        public async Task<PlcConnectionInfo> GetPlcConnectionInfoByIdAsync(long id)
        {
            return await _PlcConnectionInfoService.GetPlcConnectionInfoByIdAsync(id);
        }

        public async Task<bool> CreatePlcConnectionInfoAsync(PlcConnectionInfo plcConnectionInfo)
        {
            return await _PlcConnectionInfoService.CreatePlcConnectionInfoAsync(plcConnectionInfo);
        }

        public async Task<bool> ModifyPlcConnectionInfoAsync(PlcConnectionInfo plcConnectionInfo)
        {
            return await _PlcConnectionInfoService.ModifyPlcConnectionInfoAsync(plcConnectionInfo);
        }

        public async Task<bool> DeletePlcConnectionInfoAsync(List<PlcConnectionInfo> plcConnectionInfoList)
        {
            return await _PlcConnectionInfoService.DeletePlcConnectionInfoAsync(plcConnectionInfoList);
        }
        public async Task<bool> DeletePlcConnectionInfoByIdAsync(long id)
        {
            return await _PlcConnectionInfoService.DeletePlcConnectionIndoByIdAsync(id);
        }

        
        public async Task<PlcConnectionInfo> GetPlcConnectionInfoByIpAsync(string ip)
        {
            return await _PlcConnectionInfoService.GetPlcConnectionInfoByIpAsync(ip);
        }

        #region plc连接锁定与状态相关
        public async Task<List<PlcConnectionStateInfoDto>> GetPlcConnectionStateInfoAsync(QueryPlcConnectionStateInfoDto queryPlcConnectionStateInfoDto)
        {
            return await _PlcConnectionInfoService.GetPlcConnectionStateInfoAsync(queryPlcConnectionStateInfoDto);
        }

        public async Task<List<PlcConnectionLockInfoDto>> GetPlcConnectionLockInfoAsync(QueryPlcConnectionLockInfoDto queryPlcConnectionLockInfoDto)
        {
            return await _PlcConnectionInfoService.GetPlcConnectionLockInfoAsync(queryPlcConnectionLockInfoDto);
        }
        #endregion
    }
}
